// "Copyright [2021] <Copyright Shengkai Lin>"

#ifndef CLUSTER_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_ALGO_GPU_SCHEDULE_ALGO_H_
#define CLUSTER_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_ALGO_GPU_SCHEDULE_ALGO_H_

#include "cluster/basic/ai_sim.h"
#include "cluster/basic/topology.h"
#include "cluster/network_controller/topo_manager/topo_manager.h"

namespace ai_sim {

// Algorithms here is responsible to schedule gpus according to different
// strategy, including worstcase, bestcase, random and manually
// Strategies:
// Best case: actually sequentially schedule
// Worst case: separate the workers to different machines.
// Randomly: schedule the workers according to the pseudo random number.

class GpuScheduleAlgorithm {
 public:
    virtual void scheduleGpu(taskboard&, TopoManager *, int job_num) = 0;
    static GpuScheduleAlgorithm* get(GpuScheduleAlgo type);
    virtual ~GpuScheduleAlgorithm(){}
};

class SequentialScheduleAlgorithm : public GpuScheduleAlgorithm {
 public:
    void scheduleGpu(taskboard&, TopoManager *, int job_num);
};

// class BestcaseScheduleAlgorithm : public GpuScheduleAlgorithm {
//  public:
//     void scheduleGpu(taskboard&, TopoManager *);
// };

class WorstcaseScheduleAlgorithm : public GpuScheduleAlgorithm {
 public:
    void scheduleGpu(taskboard&, TopoManager *, int job_num);
};

class RandomlyScheduleAlgorithm : public GpuScheduleAlgorithm {
 public:
    void scheduleGpu(taskboard&, TopoManager *, int job_num);
};

}  // namespace ai_sim
#endif  // CLUSTER_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_ALGO_GPU_SCHEDULE_ALGO_H_
